import { Component, OnInit } from '@angular/core';
import { Blade } from "../../../shared/blade/blade.model";
import { BladeService } from "../../../shared/blade.service";
import { BladeData } from "../../../shared/blade/blade-data";
import { Observable } from "rxjs/Observable";
import { DeviceListComponent } from "./device-list/device-list.component";
@Component({
  selector: 'app-device',
  templateUrl: './device.component.html',
  styleUrls: ['./device.component.css'],
  providers: [BladeService]

})
export class DeviceComponent implements OnInit {

  /**
   * 当前弹出层
   * @type {Blade}
   * @memberof BladeContainerInterface
   */
  currentBlade: Blade;
  constructor(public bladeService: BladeService) { }

  ngOnInit() {
    this.createDeviceListtBlade()
  }

  /**
   * 创建设备列表弹出层
   * @memberof DicComponent
   */
  createDeviceListtBlade() {
    let data: BladeData = new BladeData();
    data.id = "deviceList";
    data.title = "设备列表";
    data.isClosingDisabled = true;
    this.currentBlade = this.bladeService.createBlade(DeviceListComponent, data);
    this.bladeService.showBlade(this.currentBlade);
  }
  /**
  * 是否可以离开
  * @memberof DicComponent
  */
  canDeactivate(): boolean | Observable<boolean> | Promise<boolean> {
    return true;
  }

}



// WEBPACK FOOTER //
// ./src/app/module/basic/device/device.component.ts